Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
It appears that this happens due to some classloading issue. A workaround that is know to work is to call the following before creating the cache manager or container:
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());